﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using Persons.DS;
using Persons.Interfaces;
using Persons.DataStore;

namespace Persons.Tests
{
    /// <summary>
    /// Тестирование фабрики
    /// </summary>
    [TestFixture]
    public class UT_Factory
    {
        private static object[] myTestCaseParam =
            {
               new object[]{"csv",null,new DS_CSV()},
               new object[]{"db", null,new DS_DB()},
               new object[]{"mock", null,new DS_MOCK()}, 
               new object[]{"net", null,new DS_NET_CLIENT()} 
            };

        [Test, TestCaseSource("myTestCaseParam")]
        public void UTFactory(string _ext, string path, IDS expected)
        {
            IDS actual = Factory.GetInstance(_ext, path);
            Assert.AreEqual(expected.GetType().Name, actual.GetType().Name);
        }
        [TestCase("xml",null,null)]
        public void UTFactoryNull(string _ext, string path, IDS expected)
        {
            IDS actual = Factory.GetInstance(_ext, path);
            Assert.AreEqual(expected, actual);
        }
    }
}
